(function () {
    function NormalAlertUI() {
        NormalAlertUI.super(this);
        this.isPopup = false;
        this.custom = true;
        this._tpl = '<div style="width:465px;height:200px;line-height:40px;font-size:30px;color:#ffffff;text-align:center;font-family:microsoft yahei;">{message}</div>';
        this.closeCallback = null;
        this.closeType = 0;

        this.btnClose.on(Laya.Event.CLICK, this, function () {
            if(this.closeType == 1){
                if(this.closeCallback && (typeof this.closeCallback === "function")){
                    this.closeCallback(this.noNotice.visible && this.noNotice.selected);
                }
            }
            this.close();
        });

        this.btnConfirm.on(Laya.Event.CLICK, this, function () {
            if(this.closeCallback && (typeof this.closeCallback === "function")){
                this.closeCallback();
            }

            this.close();
        });
    }
    Laya.class(NormalAlertUI, "ui.Alert.Normal", ui.Alert.NormalUI);
    var _proto = NormalAlertUI.prototype;

    _proto.display = function (param) {
        var closeHandler = param.closeHandler;
        var message = param.message;

        this.isPopup = true;
        this.width = Laya.stage.width;

        if(param.closeType){
            this.closeType = param.closeType;
        }
        
        this.closeCallback = closeHandler;
        this.message.innerHTML = this._tpl.replace(/{message}/gi, message);
        this.alertContent.height = Math.ceil(message.length / 15) * 40 + 300;

        if(param.checkBox && param.checkBox.visible == true){
            this.noNotice.selected = !!param.checkBox.checked;
            this.noNotice.visible = true;
            this.alertContent.height += 70;
        }else{
            this.noNotice.visible = false;
        }
        
        Laya.stage.addChild(this);
    }
    _proto.close = function () {
        this.isPopup = false;
        this.closeCallback = null;
        this.closeType = 0;
        this.removeSelf();
    }
})();